/*
 * #%L
 * SwiftUICommonUtilities
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2011 - 2012 Linkwithweb
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-3.0.html>.
 * #L%
 */
/**
 * 
 */
package com.linkwithweb.products.swiftui.dataobject;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * DROP TABLE IF EXISTS `automata`.`frm_form`;
CREATE TABLE  `automata`.`frm_form` (
  `FORM_EKEY` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `FORM_NAME` varchar(45) NOT NULL,
  `FORM_ID` varchar(45) NOT NULL,
  `TABLE_ID` varchar(45) NOT NULL,
  `FORM_LAYOUT` varchar(45) NOT NULL,
  `FORM_THEME` varchar(45) NOT NULL,
  `FORM_ACTION` varchar(45) NOT NULL,
  `IDENTIFIER` varchar(45) NOT NULL,
  `IDENTIFIER_ROLE` varchar(45) NOT NULL,
  `CREATED_BY` int(10) unsigned NOT NULL,
  `CREATED_DATE` datetime NOT NULL,
  `MODIFIED_BY` int(10) unsigned NOT NULL,
  `MODIFIED_DATE` datetime NOT NULL,
  PRIMARY KEY (`FORM_EKEY`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 * @author ashwin kumar
 *
 */
public class FrameworkForm extends BaseDataObject{

	private long formKey = -1;
	private String formId = "";
	private String formName = "";
	private String tableId = "";
	private String formLayout = "";
	private String formTheme = "";
	private String formAction = "";
	
	private FrameworkTable frameworkTable = null;
	private List<FrameworkFormField> formFields = new ArrayList<FrameworkFormField>();
	/**
	 * @return the formKey
	 */
	public long getFormKey() {
		return formKey;
	}
	/**
	 * @param formKey the formKey to set
	 */
	public void setFormKey(long formKey) {
		this.formKey = formKey;
	}
	/**
	 * @return the formId
	 */
	public String getFormId() {
		return formId;
	}
	/**
	 * @param formId the formId to set
	 */
	public void setFormId(String formId) {
		this.formId = formId;
	}
	/**
	 * @return the formName
	 */
	public String getFormName() {
		return formName;
	}
	/**
	 * @param formName the formName to set
	 */
	public void setFormName(String formName) {
		this.formName = formName;
	}
	/**
	 * @return the tableId
	 */
	public String getTableId() {
		return tableId;
	}
	/**
	 * @param tableId the tableId to set
	 */
	public void setTableId(String tableId) {
		this.tableId = tableId;
	}
	/**
	 * @return the formLayout
	 */
	public String getFormLayout() {
		return formLayout;
	}
	/**
	 * @param formLayout the formLayout to set
	 */
	public void setFormLayout(String formLayout) {
		this.formLayout = formLayout;
	}
	/**
	 * @return the formTheme
	 */
	public String getFormTheme() {
		return formTheme;
	}
	/**
	 * @param formTheme the formTheme to set
	 */
	public void setFormTheme(String formTheme) {
		this.formTheme = formTheme;
	}
	/**
	 * @return the formAction
	 */
	public String getFormAction() {
		return formAction;
	}
	/**
	 * @param formAction the formAction to set
	 */
	public void setFormAction(String formAction) {
		this.formAction = formAction;
	}
	/**
	 * @return the frameworkTable
	 */
	public FrameworkTable getFrameworkTable() {
		return frameworkTable;
	}
	/**
	 * @param frameworkTable the frameworkTable to set
	 */
	public void setFrameworkTable(FrameworkTable frameworkTable) {
		this.frameworkTable = frameworkTable;
	}
	/**
	 * @return the formFields
	 */
	public List<FrameworkFormField> getFormFields() {
		return formFields;
	}
	/**
	 * @param formFields the formFields to set
	 */
	public void setFormFields(List<FrameworkFormField> formFields) {
		this.formFields = formFields;
	}
	
	/**
	 * Makes sure we have one instance of Form Field(Behaves like set)
	 * 
	 * @param reportColumn
	 */
	public void addField(FrameworkFormField formField) {
		int objectIndex = this.formFields.indexOf(formField);
		if (objectIndex == -1) {
			this.formFields.remove(formField);
			this.formFields.add(formField);
		} else {
			this.formFields.set(objectIndex, formField);
		}
		
	}
	
}
